import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {

    path: "/",
    alias: "/login",
    name: 'login',
    meta: { title: '登录' },
    component: () => import('@/views/chb/Login.vue')
  },
  {
    path: '/main',
    name: 'Backstage',
    component: () => import('../views/chenlin/Backstage.vue'),
    meta: { title: '首页' },
    children: [
      {
        path: '',
        meta: { title: '首页' },
        component: () => import('../components/hy/rightpage.vue')
      },
      {
        path: "rightpage",
        name: 'rightpage',
        meta: { title: '首页' },
        component: () => import("@/components/hy/rightpage.vue")
      },
      {
        path: 'viewhouserequest',
        name: 'viewhouserequest',
        meta: { title: '看房请求' },
        component: () => import('@/views/ht/ViewHouseRequest.vue')
      },
      {
        path: 'rentalmanagement',
        name: 'rentalmanagement',
        meta: { title: '租房管理' },
        component: () => import('@/views/ht/RentalManagement.vue')
      },
      {
        path: 'houselist',
        name: 'houselist',
        meta: { title: '房源列表' },
        component: () => import('@/components/chb/HouseTable.vue'),
      },
      {
        path: 'houseimg',
        name: 'houseimg',
        meta: { title: '房源图片' },
        component: () => import('@/components/lwj/Maap.vue')
      },
      {
        path: 'addhouse',
        name: 'addhouse',
        meta: { title: '添加房源' },
        component: () => import('@/components/chb/AddHouse.vue')
      },
      {
        path: 'ownerlist',
        name: 'ownerlist',
        meta: { title: '房东列表' },
        component: () => import('@/views/pmd/LanorList.vue')
      },
      {
        path: 'billmanagement',
        name: 'billmanagement',
        meta: { title: '账单管理' },
        component: () => import('@/views/zhs/BillManagement.vue')
      },
      {
        path: 'withdrawalaudit',
        name: 'withdrawalaudit',
        meta: { title: '提现审核' },
        component: () => import('@/views/zhs/WithdrawalAudit.vue')
      },
      {
        path: 'userlist',
        name: 'userlist',
        meta: { title: '用户列表' },
        component: () => import('@/views/pmd/UserList.vue')
      },
      {
        path: 'conmanagement',
        name: 'conmanagement',
        meta: { title: '合同管理' },
        component: () => import('@/components/lwj/ContractManage.vue')
      },
      {
        path: "houseport",
        name: 'houseport',
        meta: { title: '房源接口' },
        component: () => import("@/components/lqk/HousingInterface.vue")
      },
      {
        path: "houseconfig",
        name: 'houseconfig',
        meta: { title: '字典配置' },
        component: () => import("@/components/lqk/FaCility.vue")
      },
      {
        path: "tianjia",
        name: 'tianjia',
        meta: { title: '合同模板' },
        component: () => import("@/components/hy/tianjia.vue")
      },
      {
        path: 'quelist',
        name: 'quelist',
        meta: { title: '资讯列表' },
        component: () => import('@/components/lwj/ConsulBody.vue'),
      },
      {
        path: 'faq',
        name: 'faq',
        component: () => import('../views/chenlin/Faq.vue'),
        meta: { title: '问答管理' }
      }
    ]
  },
  {
    path: "/contractYemplate",
    name: 'contractYemplate',
    component: () => import("@/components/hy/contractYemplate.vue")
  },
  {
    path: "*",
    name: 'page404',
    component: () => import('@/views/Page404.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  routes
})

router.afterEach((to,from)=>{
  // console.log(to.meta.title)
  document.title=to.meta.title
})

export default router
